import { createStore } from 'vuex';
import createPersistedState from 'vuex-persistedstate';

const store = createStore({
  state: {
    currentUsername: '', // 用于存储当前登录用户的用户名
    curToken: '1',
  },
  mutations: {
    setUsername(state, username) {
      state.currentUsername = username;
    },
    setToken(state,token){
      state.curToken = token;
    },
  },
  actions: {},
  modules: {},
  plugins: [createPersistedState()],
});

export default store;